import { request } from "@/utils/service"
import type * as Teams from "./types"

/** 增 */
export function createTeamsApi(data: Teams.CreateOrUpdateTeamsRequestData) {
  return request({
    url: "teams",
    method: "post",
    data
  })
}

/** 删 */
export function deleteTeamsApi(id: string) {
  return request({
    url: `teams/${id}`,
    method: "delete"
  })
}

/** 改 */
export function updateTeamsApi(data: Teams.CreateOrUpdateTeamsRequestData) {
  return request({
    url: "teams/" + data.id,
    method: "put",
    data
  })
}

/** 查 */
export function getTeamsApi(params: Teams.GetTeamsRequestData) {
  return request<Teams.GetTeamsResponseData>({
    url: "teams",
    method: "get",
    params
  })
}

/** 查详情 */
export function getTeamsDetailApi(id: string) {
  return request<Teams.GetNewResponeseDetailData>({
    url: `teams/${id}`,
    method: "get"
  })
}
